<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.min.js"></script>
</head>

<body>
  <div id="app">
    <template v-for="(item,i) in attrs" :key="i">
      <!-- <component :is="item.type" :configProps="item.ptops"></component> -->
      <allComponent :configProps="item" />
    </template>
  </div>

  <script>
    var jInput = {
      template: `
        <div>
          <input v-bind="$attrs"/>
        </div>
      `
    }

    var jSelect = {
      template: `
        <div>
          <input v-bind="$attrs" />
        </div>
      `
    }

    var allComponent={
      components:{
        jInput,
        jSelect
      },
      props:{
        configProps:{
          required:true
        }
      },
      render(h){
        return h(`${this.configProps.type}`,{
          props:{
            ...this.configProps.props||{}
          },
          attrs:{
            ...this.configProps.props||{}
          }
        })
      }
    }
    var vm = new Vue({
      el: '#app',
      data: {
        attrs: [{
          type: 'Input',
          props: {
            placeholder: '我是默认值',
            clearable: true
          }
        }, {
          type: 'Select',
          props: {
            placeholder: '我是默认值'
          }
        }, {
          type: 'Input',
          props: {
            placeholder: '我是默认值',
            suffixIcon: 'el-icon-delete'
          }
        }]
      },
      components:{allComponent}
    });
  </script>
</body>

</html>